// Toolset.h provides the attributes of the Toolset class
//-----------------

#if !defined( ToolsetH)
#define ToolsetH

//-----------------
// Includes various libraries and files
#include <cassert>		// for asserts
#include <d3dx9.h>		// Direct 3D library (for all Direct 3D functions)
#include <dirent.h>		// for searching through files in a directory
#include <fstream>		// for reading files
#include <list>
#include <string>

#include "AudioAsset.h"
#include "constants.h"
#include "Cursor.h"
#include "FileManager.h"
#include "Macrobar.h"
#include "Menubar.h"
#include "Mesh.h"
#include "MeshOrthographic.h"
#include "ModelAsset.h"
#include "Player.h"
#include "SidebarAssets.h"
#include "SidebarPlaced.h"
#include "UserInput.h"
#include "UserInterface.h"
#include "Window.h"
//-----------------

class Toolset {
	public:
		// constructor and destructor
		Toolset( LPDIRECT3DDEVICE9 device, const Window& window, UserInterface* p_ui, std::vector<Mesh>* models);
		~Toolset();

		// accessors
		int get_grid_size_x() const;
		int get_grid_size_z() const;
		void get_active_grid_square( int& x, int& z) const;

		// mutators
		HRESULT load_assets();

		void set_grid_size( const int& x, const int& z);
		void move_grid_selection_up();
		void move_grid_selection_down();
		void move_grid_selection_left();
		void move_grid_selection_right();
		void delete_grid_selection();

		void process_interaction( const Window& window, Cursor& mouse);
		void process_input_toolset( const UserInput& input, Player& player, int& state, const int& STATE_MENU, const int& x, const int& y);

		void render_perspective() const;
		void render_orthographic( const Window& window, const Cursor& mouse);

	private:
		void reset();

		LPDIRECT3DDEVICE9 device_;
		UserInterface* p_ui_;
		std::vector<Mesh>* p_models_;
		FileManager fm_;

		Menubar menubar_;
		Macrobar macrobar_;
		SidebarAssets sidebar_assets_;
		SidebarPlaced sidebar_placed_;

		std::list<AudioAsset> audio_assets_;
		std::list<std::string> ignored_assets_;

		int grid_size_x_, grid_size_z_;
		int grid_active_x_, grid_active_z_;
		float distance_;
		Mesh toolset_tile_;
		MeshOrthographic selected_tile_;
		LPDIRECT3DTEXTURE9 texture_highlight_;

		bool models_loaded_;
		bool asset_border_, placed_border_;
};

#endif